package org.example.api.goods.goods.enums;

import lombok.Getter;

@Getter
public enum SalesTypeEnum {
  /**
   * 精确的
   */
  EXACT("1","精确的"),
  /**
   * 粗略的
   */
  ROUGH("2","粗略的");

  final String code;
  final String desc;

  SalesTypeEnum(String code, String desc) {
    this.code = code;
    this.desc = desc;
  }

  //根据code获取枚举
  public static SalesTypeEnum getByCode(String code){
    for (SalesTypeEnum salesTypeEnum : SalesTypeEnum.values()) {
      if(salesTypeEnum.getCode().equals(code)){
        return salesTypeEnum;
      }
    }
    return null;
  }
}
